Skip to content

feat: display juju debug-log in integration test runs#360

Open
PietroPasotti wants to merge 27 commits intomainfrom
feat/jdl-upload
Open

feat: display juju debug-log in integration test runs#360
PietroPasotti wants to merge 27 commits intomainfrom
feat/jdl-upload

Conversation

@PietroPasotti
Copy link
Copy Markdown
Contributor

@PietroPasotti PietroPasotti commented Jul 7, 2025

Change to _charm-quality-checks.yaml (integration tests part) adding two steps:

for each file found in ./.logs:

  1. print to console
  2. upload it as artifact

the idea is, we can put our juju debug-log output in there, and the CI will display them and upload as artifact.

Context: canonical/pytest-jubilant#11

Tandem PR to demonstrate the workflow in action: https://github.com/canonical/o11y-tester-operator/actions/runs/16414197049

@PietroPasotti PietroPasotti requested a review from a team as a code owner July 7, 2025 11:54
Copy link
Copy Markdown
Contributor

@lucabello lucabello left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To re-review this PR, I would like:

  • convert the PR title to conventional commits format, like we practice everywhere
  • test the branch with some repository (if you don't know which one, use https://github.com/canonical/o11y-tester-operator) and link a successful run here
  • consider updating the diagram here and see how it looks like (adding another box under integration tests maybe)?

Comment thread .github/workflows/_charm-quality-checks.yaml Outdated
Comment thread .github/workflows/_charm-quality-checks.yaml Outdated
Comment thread .github/workflows/_charm-quality-checks.yaml Outdated
Comment thread .github/workflows/_charm-quality-checks.yaml Outdated
Comment thread .github/workflows/_charm-quality-checks.yaml Outdated
@PietroPasotti PietroPasotti changed the title Display juju debug-log in integration test runs feat: display juju debug-log in integration test runs Jul 11, 2025
@PietroPasotti
Copy link
Copy Markdown
Contributor Author

@lucabello ready for another round, all points addressed

@PietroPasotti PietroPasotti requested a review from lucabello July 23, 2025 08:28
@PietroPasotti PietroPasotti changed the title feat: display juju debug-log in integration test runs [feat]: display juju debug-log in integration test runs Jul 23, 2025
@PietroPasotti PietroPasotti changed the title [feat]: display juju debug-log in integration test runs feat: display juju debug-log in integration test runs Jul 23, 2025
@lucabello lucabello requested a review from Copilot April 23, 2026 12:01
@lucabello
Copy link
Copy Markdown
Contributor

@copilot please make comment suggestions that would make the workflows lint pass.

Copy link
Copy Markdown

Copilot AI commented Apr 23, 2026

@copilot please make comment suggestions that would make the workflows lint pass.

Fixed in 07b4840. The issue was a shellcheck SC2193 warning on the [[ "${{ inputs.log-path }}" = /* ]] comparison — actionlint replaces GitHub expressions with placeholders before passing to shellcheck, so shellcheck saw a literal string being compared to a glob pattern (/*) and flagged it as "can never be equal". Replaced it with a case statement which shellcheck handles correctly. actionlint now passes with no errors.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR extends the charm CI reusable workflows to surface integration test logs in GitHub Actions output and as downloadable artifacts, making debugging (e.g., Juju debug-log) easier across charm repositories.

Changes:

  • Adds a new log-path workflow input (default .logs) to control where integration test logs are collected from.
  • Updates the quality-checks workflow to display *.txt logs in the job output and upload the log directory as an artifact.
  • Updates the README Mermaid workflow diagram to include the new log display/upload steps.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 9 comments.

File Description
README.md Documents the additional “Display logs” / “Upload logs” steps in the workflow diagram.
.github/workflows/charm-pull-request.yaml Introduces log-path input and forwards it into the reusable quality-checks workflow.
.github/workflows/_charm-quality-checks.yaml Adds log-path input and implements log display + upload behavior for integration runs.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

log-path:
type: string
description: |
Path to a directory where the .txt logfiles for an integration testing run will be stored.
Copy link

Copilot AI Apr 23, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Spelling: use "log files" instead of "logfiles".

Suggested change
Path to a directory where the .txt logfiles for an integration testing run will be stored.
Path to a directory where the .txt log files for an integration testing run will be stored.

Copilot uses AI. Check for mistakes.
description: |
Path to a directory where the .txt logfiles for an integration testing run will be stored.
Relative and absolute file paths are both allowed.
Relative paths are rooted against the charm repository root.
Copy link

Copilot AI Apr 23, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The log-path description says relative paths are rooted against the "charm repository root", but the called workflow’s implementation prepends inputs.charm-path for relative paths. Please align this description with the actual behavior so callers don’t misplace logs.

Suggested change
Relative paths are rooted against the charm repository root.
Relative paths are resolved relative to `charm-path`.

Copilot uses AI. Check for mistakes.
Comment thread README.md
pack["Pack the charm"]
integration["Integration tests"]
displaylogs["Display logs"]
uploadlogs["Upload logs zipfile"]
Copy link

Copilot AI Apr 23, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Spelling: "zipfile" → "zip file" in the diagram label.

Suggested change
uploadlogs["Upload logs zipfile"]
uploadlogs["Upload logs zip file"]

Copilot uses AI. Check for mistakes.
Comment on lines +10 to +19
log-path:
type: string
description: |
Path to a directory where the .txt logfiles for an integration testing run will be stored.
Relative and absolute file paths are both allowed.
Relative paths are rooted against the charm repository root.
Paths that begin with a wildcard character should be quoted to avoid being
interpreted as YAML aliases.
required: false
default: .logs
Copy link

Copilot AI Apr 23, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Security: the workflow later interpolates ${{ inputs.log-path }} / derived outputs directly into run: bash scripts. If a caller supplies a value containing $()/backticks/newlines, it can lead to script-injection. Prefer passing the input via env: (e.g., LOG_PATH: ${{ inputs.log-path }}) and then using "$LOG_PATH" inside the script, which treats the value as data rather than code.

Copilot uses AI. Check for mistakes.
Comment on lines +10 to +19
log-path:
type: string
description: |
Path to a directory where the .txt logfiles for an integration testing run will be stored.
Relative and absolute file paths are both allowed.
Relative paths are rooted against the charm repository root.
Paths that begin with a wildcard character should be quoted to avoid being
interpreted as YAML aliases.
required: false
default: .logs
Copy link

Copilot AI Apr 23, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The log display/upload steps appear to be added only to the parallel integration job. If parallelize-integration is disabled (sequential integration run), logs won’t be shown or uploaded; consider applying the same log handling to the sequential integration job as well so behavior is consistent across integration modes.

Copilot uses AI. Check for mistakes.
log-path:
type: string
description: |
Path to a directory where the .txt logfiles for an integration testing run will be stored.
Copy link

Copilot AI Apr 23, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Spelling: use "log files" instead of "logfiles".

Suggested change
Path to a directory where the .txt logfiles for an integration testing run will be stored.
Path to a directory where the .txt log files for an integration testing run will be stored.

Copilot uses AI. Check for mistakes.
Comment thread README.md
Comment on lines +63 to +64
displaylogs["Display logs"]
uploadlogs["Upload logs zipfile"]
Copy link

Copilot AI Apr 23, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the Mermaid workflow diagram, displaylogs and uploadlogs are added but not connected to the existing flow. Consider adding edges (e.g., integration --> displaylogs --> uploadlogs) so the diagram reflects when these steps run.

Copilot uses AI. Check for mistakes.
Comment on lines +10 to +19
log-path:
type: string
description: |
Path to a directory where the .txt logfiles for an integration testing run will be stored.
Relative and absolute file paths are both allowed.
Relative paths are rooted against the charm repository root.
Paths that begin with a wildcard character should be quoted to avoid being
interpreted as YAML aliases.
required: false
default: .logs
Copy link

Copilot AI Apr 23, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the implementation of this log-path feature, the subsequent steps are intended to help debug failing integration tests. Ensure the log display + artifact upload steps are configured to run even when the integration test step fails (e.g., if: always()), and ensure the "show logs" loop does not fail the job when the directory exists but contains no matching *.txt files (bash will otherwise iterate the literal glob and cat will error).

Copilot uses AI. Check for mistakes.
Comment on lines +14 to +16
Relative and absolute file paths are both allowed.
Relative paths are rooted against the charm repository root.
Paths that begin with a wildcard character should be quoted to avoid being
Copy link

Copilot AI Apr 23, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The log-path description says relative paths are rooted against the "charm repository root", but the implementation later prepends inputs.charm-path for relative paths. Please clarify the wording so callers know whether the base is the repository root or the charm directory (charm-path).

Suggested change
Relative and absolute file paths are both allowed.
Relative paths are rooted against the charm repository root.
Paths that begin with a wildcard character should be quoted to avoid being
Relative and absolute file paths are both allowed.
Relative paths are rooted against the charm directory specified by `charm-path`
(which defaults to the repository root, `.`).
Paths that begin with a wildcard character should be quoted to avoid being

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants